package app

import im.yagni.common.WebServer
import im.yagni.driveby.pool.{Application, ApplicationController}

//TODO: parameterise the stubs somehow (provide a beforeStart template method perhaps) and put into driveby - with hasStarted default to true
case class InProcessApplication(name: String, port: Int) extends ApplicationController {
    val application = Application(name, port, BuildConfig.hostName)

  //TODO: call beforeStart
  val server = new WebServer(port, false)

  def start() {
    server.start()
  }

  //TODO: needs implementing by client
  def hasStarted = {
    val started = true//Given(application).hasStarted
    if (started) {
      //TODO: call afterStarted
    }
    started
  }

  def stop() { }
}